package cn.iocoder.yudao.module.system.dal.mysql.data;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.data.vo.DataPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.data.DataDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 存储用户健康相关数据，包括体检记录、症状报告、医疗历史等，用于健康分析和医疗服务 Mapper
 *
 * @author 安捷星
 */
@Mapper
public interface DataMapper extends BaseMapperX<DataDO> {

    default PageResult<DataDO> selectPage(DataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataDO>()
                .betweenIfPresent(DataDO::getRecordTime, reqVO.getRecordTime())
                .eqIfPresent(DataDO::getUserId, reqVO.getUserId())
                .eqIfPresent(DataDO::getHeartRate, reqVO.getHeartRate())
                .eqIfPresent(DataDO::getOxygenSaturation, reqVO.getOxygenSaturation())
                .eqIfPresent(DataDO::getSystolicPressure, reqVO.getSystolicPressure())
                .eqIfPresent(DataDO::getDiastolicPressure, reqVO.getDiastolicPressure())
                .eqIfPresent(DataDO::getVitalCapacity, reqVO.getVitalCapacity())
                .eqIfPresent(DataDO::getGripStrength, reqVO.getGripStrength())
                .eqIfPresent(DataDO::getBreathAlcohol, reqVO.getBreathAlcohol())
                .eqIfPresent(DataDO::getHeartAttackIndex, reqVO.getHeartAttackIndex())
                .eqIfPresent(DataDO::getStressIndex, reqVO.getStressIndex())
                .betweenIfPresent(DataDO::getReactionTime, reqVO.getReactionTime())
                .orderByDesc(DataDO::getId));
    }

}